Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
' ^ used for AlwaysOnTop sub
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
' ^ sets windows regions
Private Type POINTAPI
X As Long
Y As Long
End Type
' ^ an XY type
Const Shape_Rectange = 0
Const Shape_Square = 1
Const Shape_Oval = 2
Const Shape_Circle = 3
Const Shape_RndRectange = 4
Const Shape_RndSquare = 4
' ^ shape constants
Const conHwndTopmost = -1
Const conHwndNoTopmost = -2
' ^ top-most constants
Const RGN_AND = 1
Const RGN_COPY = 5
Const RGN_DIFF = 4
Const RGN_OR = 2
Const RGN_XOR = 3
' ^ region drawing constants
Public UD As Integer
Public LR As Integer
' ^ variables used in the bouncing timer
Dim MousePos As POINTAPI
Dp As POINTAPI
' ^ lets you to use the XY type
Dim DoDrag As Boolean
' ^ is the teddy being dragged?
Private Sub Form_DblClick()
Unload Me
' ^ exit when double clicked
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Unload Me
' ^ exit when keyboard button is pressed
End Sub
Private Sub Form_Load()
UD = -60
LR = -60
' ^ sets the initial bounce direction
AlwaysOnTop True
' ^ makes sure no other object can be placed over...
' ...the teddy
Dim t, elipHnd(999999) As Long
Dim n As Integer, eod As Integer
' ^ this bit is the variables needed for auto...
' ...drawing the forms new regions.
n = -1
eod = 0
' ^ sets their default value
For Each t In frmMain
If ((TypeOf t Is Shape) Or (t.Tag = "3")) And (t.Tag <> "1") Then